package com.sanbi.erp.core.dto;

import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.math.BigDecimal;
import java.time.LocalDateTime;

/**
 * @author wanggang
 * @desc 商品dto
 * @time 2022/7/15 18:38
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class GoodsDto {

    //优选类型：1 历史优选，2 今日优选，3 即将开市
    private Byte bestType;

    //优选日期
    private LocalDateTime bestDate;

    //市场价
    @JsonSerialize(using = ToStringSerializer.class)
    private BigDecimal marketPrice;

    //批发价
    @JsonSerialize(using = ToStringSerializer.class)
    private BigDecimal wholesalePrice;

    //零售价
    @JsonSerialize(using = ToStringSerializer.class)
    private BigDecimal retailPrice;

    //起批数量
    private Integer wholesaleNumber;

    //历史批发价
    @JsonSerialize(using = ToStringSerializer.class)
    private BigDecimal historyWholesalePrice;

    //历史零售价
    @JsonSerialize(using = ToStringSerializer.class)
    private BigDecimal historyRetailPrice;

    //重量
    private BigDecimal weight;

    //长
    private Integer length;

    //宽
    private Integer width;

    //高
    private Integer height;

    //体积重
    private BigDecimal cubageWeight;

    /**
     * 获取重量和体积重的有参构造
     *
     * @param weight       商品重量
     * @param cubageWeight 商品体积重
     */
    public GoodsDto(BigDecimal weight, BigDecimal cubageWeight) {
        this.weight = weight;
        this.cubageWeight = cubageWeight;
    }

    /**
     * 获取长宽高有参构造
     */
    public GoodsDto(Integer length, Integer width, Integer height) {
        this.length = length;
        this.width = width;
        this.height = height;
    }
}
